//重组树形结构数据
export const formateTree = (data, name) => {
    //解析所有的数据
    const _newData = data.map((item) => {
        return setIntoData(item, name);
    });
    return _newData;
}

//套入数据
const setIntoData = (obj, name) => {
    obj.name = name;
    if (obj.children) {
        obj.children.map((item) => {
            setIntoData(item, name);
        });
    }
    return obj;
}

